package com.vidyu.datalayer.dataaccesscomponents.impl;

import com.vidyu.businesslayer.businessentities.Session;
import com.vidyu.datalayer.dataaccesscomponents.SessionDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by IntelliJ IDEA.
 * Session: eyalsa
 * Date: 12/03/12
 * Time: 10:25
 * To change this template use File | Settings | File Templates.
 */

@SuppressWarnings({"unchecked", "UnusedDeclaration"})
@Repository("sessionDao")
public class SessionDaoImpl extends BaseDaoImpl implements SessionDao {
    @Autowired
    private HibernateTemplate template;

    public Session findById(long id){
        return template.get(Session.class, id);
    }
    @Override
    @Transactional(readOnly = false, propagation = Propagation.NESTED)
    public long save(Session session){
        return((Long) template.save(session));
    }
}

